Note: This tutorial assumes that you have completed the previous tutorials: ROV Prerequisites.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Flashing an SD Card with Ubuntu

Description: Instructions to install the operating system onto the ROV's computer.

Tutorial Level: INTERMEDIATE

Next Tutorial: Wifi Network Setup

We are using a RaspberryPi 2 as our embedded ROV computer. We recommend installing Ubuntu 14.04 on the RaspberryPi over Rasbian OS because of the ease of installing ROS packages. On Ubuntu, packages can be installed as binaries from apt, but on Rasbian, most packages must be installed from source.

Follow these instructions to flash Ubuntu onto an SD card for the RaspberryPi.

# get the image
cd ~/Downloads
wget http://www.finnie.org/software/raspberrypi/2015-04-06-ubuntu-trusty.zip
sudo apt-get install unzip
unzip 2015-04-06-ubuntu-trusty.zip

# prepare the install destination
df -h # determine the file path of the SD card, /dev/sdb in this case
eject /dev/sdb

# install the image
sudo bmaptool copy --bmap ~/Downloads/2015-04-06-ubuntu-trusty.bmap ~/Downloads/2015-04-06-ubuntu-trusty.img /dev/sdb

Once the install has completed, use a keyboard and monitor to complete the partition resizing and to set up networking. The username and password for the standard Ubuntu image is ubuntu:ubuntu. After the SSH server has been installed, you can work remotely.

There are no Raspbian-specific utilities included, specifically no automatic root resizer. However, it's not hard to do manually. Once booted, you'll need to resize the primary partition and create a swapfile:

sudo fdisk /dev/mmcblk0
# Delete the second partition (d, 2),
# then re-create it using the defaults (n, p, 2, enter, enter),
# then write and exit (w)
# then restart.

sudo shutdown -r now

sudo resize2fs /dev/mmcblk0p2

You can use dh -f to verify the partition has been resized.

If you get stuck, this [[http://elinux.org/RPi_Resize_Flash_Partitions#Manually_resizing_the_SD_card_on_Linux https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=24993|elinux page]] is also a good resource for flashing SD cards.

After installing Ubuntu on the Pi, perform these additional commands:

sudo hostname bluerov
sudo sh -c 'echo "bluerov" > /etc/hostname'

sudo apt-get update
sudo apt-get install dphys-swapfile libraspberrypi-bin libraspberrypi-dev openssh-server wpasupplicant git build-essential avahi-daemon screen linux-firmware -y
sudo apt-get upgrade -y

# some libraries require the libraspberrypi-bin and libraspberrypi-dev files at /opt/vc
sudo ln -s /usr /opt/vc

Wiki: bluerov/Tutorials/Flashing an SD Card with Ubuntu (last edited 2016-02-15 09:45:07 by JoshVillbrandt)